package com.example.core.service;

import com.example.core.convert.context.RequestContext;
import com.example.core.dao.BaseDao;
import com.example.core.form.BaseForm;
import com.example.core.hql.HQLInfo;
import com.example.core.model.BaseModel;
import com.example.utils.Page;

import javax.persistence.Query;
import java.util.List;

public interface BaseService<D extends BaseDao<T>, T extends BaseModel> {

    public D getBaseDao();

    public Class<?> getEntityClass();

    public String getEntity();

    public T findByPrimaryKey(String fdId);

    public T findByPrimaryKey(String fdId, Boolean noLazy);

    public String add(T model) throws Exception;

    public String add(BaseForm form, RequestContext requestContext) throws Exception;

    public void update(T model) throws Exception;

    public void delete(T model) throws Exception;

    public Page findPage(HQLInfo hqlInfo) throws Exception;

    public List<T> findList(HQLInfo hqlInfo) throws Exception;

    public Query createHbmQuery(HQLInfo hqlInfo) throws Exception;

    public BaseModel convertFormToModel(BaseForm form, RequestContext requestContext) throws Exception;

    public BaseForm convertModelToForm(BaseModel model, RequestContext requestContext) throws Exception;

    public BaseForm initFormSetting(RequestContext requestContext) throws Exception;
}
